﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Betop.Lib.Data;

namespace Betop.Lib.Core.Dispatch
{
    public partial class DispatchInfo : EntityBase
    {
        public override string GetTableName()
        {
            return "Dispatch";
        }
        public override string GetInsertSql()
        {
            return "insert into Dispatch ( [ID], [Name], [Interval], [State]) values ( @ID, @Name, @Interval, @State)";
        }
        public override string GetUpdateSql()
        {
            return "update Dispatch set  [ID] = @ID, [Name] = @Name, [Interval] = @Interval, [State] = @State where ID = @ID";
        }
        /// <summary>
        /// PK
        /// </summary>
        public Int32 ID
        {
            get;
            set;
        }
        /// <summary>
        /// 类名(含程序集名)
        /// </summary>
        public String Name
        {
            get;
            set;
        }
        /// <summary>
        /// 周期执行时间
        /// </summary>
        public Int32 Interval
        {
            get;
            set;
        }
        /// <summary>
        /// 状态(开启 停止)
        /// </summary>
        public Int32 State
        {
            get;
            set;
        }
        public override void SetValue(string key, object value)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    this.ID = (Int32)value;
                    break;
                case "name":
                    this.Name = (String)value;
                    break;
                case "interval":
                    this.Interval = (Int32)value;
                    break;
                case "state":
                    this.State = (Int32)value;
                    break;
            }
        }
        public override object GetValue(string key)
        {
            key = key.ToLower();
            switch (key)
            {
                case "id":
                    return this.ID;
                case "name":
                    return this.Name;
                case "interval":
                    return this.Interval;
                case "state":
                    return this.State;
                default:
                    return null;
            }
        }
    }


}
